package com.shipwe.loans.http

import com.shipwe.http.callback.StringCallback
import com.shipwe.loans.utils.log.ShipweLogger
import org.json.JSONObject

/**
 * Shipwe
 * @Author wwdeng
 * @CreateTime: 2024/11/20 17:38
 * @Annotation：网络请求帮助类
 */
object HttpHelper : IHttpLoader {

    private var mHttpLoader: IHttpLoader? = null

    fun init(httpLoader: IHttpLoader) {
        mHttpLoader = httpLoader
    }

    override fun post(url: String, params: JSONObject,tag: Any, callback: IHttpCallback) {
        mHttpLoader?.post(url, params,tag, callback);
    }

    override fun upload(filePath: String,tag: Any, callback: StringCallback) {
        mHttpLoader?.upload(filePath,tag,callback)
    }

    override fun addPoint(eventName: String, remark: String, tag: Any, callback: IHttpCallback) {
//        if (ShipweLogger.isDebug) return
        mHttpLoader?.addPoint(eventName,remark,tag,callback)
    }

    override fun cancelTag(tag: Any) {
        mHttpLoader?.cancelTag(tag)
    }
}
